package cn.com.cym.gamezao.base;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.NoRepositoryBean;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Repository 基类
 * @param <T>
 * @param <Long>
 *
 * NoRepositoryBean 该注解用于处理 no an entity的问题，在构建是不去判断T是否是个table实体
 * 接口不会在运行时被创建实例，只会被作为父接口使用
 */
@Repository
@NoRepositoryBean
public interface BaseRepository<T extends BaseEntity,Long> extends JpaRepository<T,Long> {

    Page<T> findAll(Specification<T> spec, Pageable pageable);

    List<T> findAllByDeleted(Boolean deleted);
}
